package Anagram;

import java.io.*;
import java.util.Collection;
import java.util.Map;
import java.util.Set;

/**
 * User: Vitalii Serdiuk
 * Date: 05.12.13 14:43
 */
public class FileWriter {
    public void writeToFile(String outPathName, Map<String, Set<Word>> wordsTable) {

        try {
            System.setOut(new PrintStream(new File(outPathName)));
        } catch (Exception e) {
            e.printStackTrace();
        }

        for (Collection<Word> words : wordsTable.values()) {
            if(words.size()>1){
            for (Word anagrams : words){
                if (words.size() > 1)
                    System.out.print(anagrams + " ");
            }
            System.out.println();}
        }

    }
}

